<div class="form">


<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'objectlink-form',
	'enableAjaxValidation'=>false,
)); ?>

<?php echo CHtml::ajaxButton($model->isNewRecord ? 'Create' : 'Update',
        CHtml::normalizeUrl(array('//objectlink/subviewedit')),
        array(
            'type'=>'POST',
            'success'=>'function(data) {
                            ﻿var obj = jQuery.parseJSON(data);
                            $("#Objectlink_objectlink_id").val(obj.objectlink_id);
                            $("#rec_save_button").attr("value","Update");
                            $("#mySubViewForm").show();
                            $("#myFilterSubViewForm").show();
                            $.fn.yiiGridView.update(\'objectlink_table\');
                        }',
        ),
        array('class'=>'ui-button ui-widget ui-state-default ui-corner-all','id'=>'rec_save_button'));
?>



    <fieldset class="box">
        <legend>Objectlink</legend>
	<?php echo $form->errorSummary($model); ?>

        <table>
            <tr class="row">
                <td width="100px">
                    <?php echo $form->labelEx($model,'org_id'); ?>
                </td>
                <td width="150px">
                    <?php

                    $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
                       //'model'=>$model,
                       'name'=>'sub_org_id',
                       'value'=>CHtml::encode(Organisation::model()->findByPK($model->org_id)->nachname),
                       'source' => $this->createUrl('Organisation/autocompleteOrganisation'),
                       'options' => array(
                            'minLength'=>'2',
                            'select'=>"js:function(event,ui){
                                $('#".CHtml::activeId($model,'org_id')."').val(ui.item.id);
                            }",
                       ),
                    ));

                    ?>
                    <?php echo $form->hiddenField($model,'org_id'); ?>
                    <?php echo $form->error($model,'org_id'); ?>
                </td>
           </tr>
        </table>
        
                <?php echo $form->hiddenField($model,'objectlink_id'); ?>
		<?php echo $form->error($model,'objectlink_id'); ?>
				
		<?php echo $form->hiddenField($model,'object_id'); ?>
		<?php echo $form->error($model,'object_id'); ?>

   </fieldset>

<?php $this->endWidget(); ?>

</div><!-- form -->

<?php
$this->widget('ext.ajaxform.JAjaxForm',array(
    'formId'=>'objectlink-form',
    'options'=>array(
        'dataType'=>'json',
    ),
));
?>